﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StoreIO
{
	//-----------------------------------------------------------------------------
	//事件
	public partial class MainForm : Form
	{
		public MainForm()
		{
			InitializeComponent();

			//Add Version info
			this.Text = this.Text + " " + Application.ProductVersion;
		}

		private void Form1_Load(object sender, EventArgs e)
		{

		}

		private void _TxtFilter_TextChanged(object sender, EventArgs e)
		{
			String text = ((TextBox)sender).Text;
			FilterList(text);
		}

		private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
		{
			KeyPressed(e.KeyChar);
		}

		private void _listAllGoods_KeyPress(object sender, KeyPressEventArgs e)
		{
			KeyPressed(e.KeyChar);
		}

		private void _tabOP_KeyPress(object sender, KeyPressEventArgs e)
		{
			KeyPressed(e.KeyChar);
		}

		private void _TxtFilter_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar == (char)SpcialChar.Retrun)
			{
				KeyPressed(e.KeyChar);
			}
		}
	}

	//UI操作
	public partial class MainForm
	{
		//-----------------------------------------------------------------------------
		public void SwitchFilterFocus()
		{
			if (_TxtFilter.Focused)
			{
				_listAllGoods.Focus();
			}
			else
			{
				_TxtFilter.Focus();
			}
		}

		//-----------------------------------------------------------------------------
		public void ClearFilter()
		{
			_TxtFilter.Clear();
		}
	}

}
